<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 

class Semail {
	var $CI;

    function __construct()
    {	
		$this->CI = & get_instance();
    }
	
/*
		$tomail : 收件人
		$mailsubject : 标题
		$html ： 内容

*/		
	function kmail($tomail,$mailsubject=1,$html=2)
	{
		//$uname = iconv("UTF-8","gb2312",$uname);
		
		$this->CI->load->helper('mailbody');
		$html = mailbody_info($html);
		
		// mailconfig
		$this->CI->load->model('smtp_model');
		$smtpserver = "smtp.ym.163.com";//SMTP服务器
		$smtpserverport =25;//SMTP服务器端口
		$smtpusermail = "service@jiaju369.com";//SMTP服务器的用户邮箱
		$smtpemailto = $tomail;//发送给谁
		$smtpuser = "service@jiaju369.com";//SMTP服务器的用户帐号
		$smtppass = "monkey";//SMTP服务器的用户密码
		$mailbody = $html;//邮件内容
		$mailtype = "HTML";//邮件格式（HTML/TXT）,TXT为文本邮件		
		// /mailconfig
		
		$this->CI->smtp_model->smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);
		$this->CI->smtp_model->debug = FALSE;//是否显示发送的调试信息
		
		return $this->CI->smtp_model->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);		
		
	}
	
	
	
	
	
	
	
	
	
	
	
	
}

?>